/**
 * author:wos
 * time:2024-1-4
 * title:删除字典数据
 */

const parseQueryParams = require("../../../utils/parseQueryParams");

async function del(ctx, next) {
    const url = ctx.request.url
    const query =Object.assign({}, parseQueryParams(url))
    if (query.dictId === undefined){
        global.response(ctx, {
            "status":200,
            "code": 500,
            "data": {},
            "msg":'参数错误'
        })
    }else{
        const sql = `delete from sys_dict_type where dict_code = ${query.dict_id}`
        try {
            let rs = await global.query(sql)
            global.response(ctx, {
                "status":200,
                "code": 200,
                "data": rs,
                "msg":'success'
            })
        } catch (err) {
            global.serverError(ctx)
        }
    }
}
module.exports = del